//
//  MineVCTableViewCell.m
//  ChartsDemo
//
//  Created by wusiping on 2021/3/31.
//

#import "MineVCTableViewCell.h"

@interface MineVCTableViewCell()

@property (nonatomic,strong) UIImageView *leftImageView;
@property (nonatomic,strong) UILabel *topLabel;
@property (nonatomic,strong) UIView *seperageView;

@end

@implementation MineVCTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self  = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self UIConfig];
    }
    return self;
}

- (void)UIConfig
{
    self.backgroundColor = [UIColor whiteColor];
    _leftImageView = [[UIImageView alloc] init];
    J_ViewRadius(_leftImageView, 22.5);
//    [_leftImageView jk_cornerRadius:22.5 strokeSize:0 color:nil];
    [self addSubview:_leftImageView];
    [_leftImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.height.mas_equalTo(45);
        make.left.mas_equalTo(30);
        make.centerY.equalTo(self);
    }];
    
    _topLabel = [[UILabel alloc] init];
    _topLabel.font = [UIFont systemFontOfSize:15];
    _topLabel.textColor = J_ColorFromHEX(0x222222);
    [self addSubview:_topLabel];
    [_topLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.leftImageView.mas_right).offset(15);
        make.height.mas_equalTo(19);
        make.centerY.equalTo(self);
    }];
    
    _rightImageView = [[UIImageView alloc] init];
    [self addSubview:_rightImageView];
    [_rightImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.height.mas_equalTo(30);
        make.right.equalTo(self.mas_right).offset(-15);
        make.centerY.equalTo(self);
    }];
    [_rightImageView setImage:[UIImage imageNamed:@"commen_ic_more"]];
    
    _rightLabel = [[UILabel alloc]init];
    _rightLabel.text = @"1";
    _rightLabel.font = J_Font(10);
    _rightLabel.textAlignment = NSTextAlignmentCenter;
    _rightLabel.textColor = [UIColor whiteColor];
    _rightLabel.backgroundColor = J_ColorFromHEX(0xE22F2F);
    [self addSubview:_rightLabel];
    [_rightLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.height.mas_equalTo(16);
        make.right.equalTo(self.mas_right).offset(-15);
        make.centerY.equalTo(self);
    }];
    J_ViewRadius(_rightLabel, 8);
    
    
    _seperageView = [[UIView alloc] init];
    [self addSubview:_seperageView];
    [_seperageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(0.5);
        make.left.right.equalTo(self);
        make.bottom.equalTo(self);
    }];
}

- (void)configWithImageName:(NSString *)name text:(NSString *)text needSeperateView:(BOOL)needSeperateView
{
    self.leftImageView.image = [UIImage imageNamed:name];
    self.topLabel.text = text;
    if (needSeperateView) {
        self.seperageView.hidden = NO;
    }else {
        self.seperageView.hidden = YES;
    }
}
@end
